package edu.tongji.jiaowu.dao.jdbc;

import java.util.List;

import edu.tongji.jiaowu.dao.OriginalScoreDao;
import com.tongji.quickCRUDQ.define.Row;
import com.tongji.quickCRUDQ.model.CommonBean;
import com.tongji.quickCRUDQ.dao.jdbc.BaseDaoJdbc;

public class OriginalScoreDaoJdbc extends BaseDaoJdbc implements OriginalScoreDao {
	String tableName = "T_ORIGINAL_SCORE";

	String beanName = "originalScore";

	public CommonBean createOriginalScore() {
		CommonBean originalScores = this.createBean(tableName, beanName);
		return originalScores;
	}

	public CommonBean findOriginalScore(String refid) {
		CommonBean originalScores = this.createOriginalScore();
		String sql = "select * from T_ORIGINAL_SCORE where refid=?";
		List data = this.getCommonDao().select(sql, new String[] { refid });
		originalScores.addData(data);
		return originalScores;
	}

	public CommonBean findOriginalScoreById(String id) {
		CommonBean originalScores = this.createOriginalScore();
		String sql = "select * from T_ORIGINAL_SCORE where id=?";
		List data = this.getCommonDao().select(sql, new String[] { id });
		originalScores.addData(data);
		return originalScores;
	}

	public CommonBean findAllOriginalScores() {
		CommonBean originalScores = this.createOriginalScore();
		String sql = "select * from T_ORIGINAL_SCORE ";
		List data = this.getCommonDao().select(sql, new String[] {});
		originalScores.addData(data);
		return originalScores;
	}

	public void insertOriginalScore(CommonBean originalScoreBean) {
		List data = originalScoreBean.getData();
		Row row = this.getRow(tableName);
		this.getCommonDao().templateBatchInsert(row, data, this.getIdGenerator());
	}
}
